/*
 * Created by JFormDesigner on Sun Nov 27 12:11:59 MSK 2011
 */

package ru.neoflex.jedit.plugin.ui;

import java.awt.*;
import javax.swing.*;
import com.jgoodies.forms.factories.*;
import com.jgoodies.forms.layout.*;
import org.gjt.sp.jedit.EBComponent;
import org.gjt.sp.jedit.EBMessage;
import org.gjt.sp.jedit.EditBus;
import org.gjt.sp.jedit.View;
import ru.neoflex.jedit.plugin.core.NeoflexState;
import ru.neoflex.jedit.plugin.utils.Assert;
import sun.awt.VerticalBagLayout;

/**
 * @author Кирилл Сазонов
 */
public class WhisdomBar extends JPanel implements IWhisdomBar, EBComponent {
    private View view;

    public WhisdomBar(View view) {
        initComponents();

        Assert.notNull(view);
        this.view = view;

        EditBus.addToBus(this);
        NeoflexState.getInstance().setWhisdomBar(this);
    }

    private void initComponents() {
        CellConstraints CC = new CellConstraints();

        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        // Generated using JFormDesigner non-commercial license
        panel1 = new JPanel();
        cbLock = new JCheckBox();
        scrollPane1 = new JScrollPane();
        editorPane = new JEditorPane();
        CellConstraints cc = new CellConstraints();

        //======== this ========
        setLayout(new FormLayout(
            "default, default:grow",
            "fill:default:grow"));

        //======== panel1 ========
        {
            panel1.setLayout(new VerticalBagLayout(1));

            //---- cbLock ----
            cbLock.setText("lock");
            panel1.add(cbLock);
        }
        add(panel1, cc.xy(1, 1));

        //======== scrollPane1 ========
        {

            //---- editorPane ----
            editorPane.setBackground(new Color(231, 255, 218));
            editorPane.setContentType("text");
            scrollPane1.setViewportView(editorPane);
        }
        add(scrollPane1, cc.xy(2, 1));
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    // Generated using JFormDesigner non-commercial license
    private JPanel panel1;
    private JCheckBox cbLock;
    private JScrollPane scrollPane1;
    private JEditorPane editorPane;
    // JFormDesigner - End of variables declaration  //GEN-END:variables

    public void setText(String text) {
        editorPane.setText(text);
    }

    public void addNotification(String notification) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public void handleMessage(EBMessage ebMessage) {
    }
}
